package com.health.security;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;
import java.util.Collections;
import java.util.Date;

/**
 * 中央认证实体类
 * @author: zipeng Li
 * 2021/6/14  19:15
 */
public class CentralAuthenticationToken extends AbstractAuthenticationToken {

    private String token;
    private Student student;

    public CentralAuthenticationToken() {
        super(Collections.emptyList());
    }
    public CentralAuthenticationToken(String token) {
        super(Collections.emptyList());
        this.token = token;
    }

    public CentralAuthenticationToken(Student student , Collection<? extends GrantedAuthority> authorities) {
        super(authorities);
        this.student = student;
        setAuthenticated(true);
    }

    @Override
    public Object getCredentials() {
        return "";
    }

    @Override
    public Object getPrincipal() {
        return null;
    }

    public String getToken() {
        return token;
    }

    public Student getStudent() {
        return student;
    }
}
